package mju.cn.oneweek.Observer;

import java.util.Observable;
import java.util.Observer;

/**
 * @program: java-ee_31
 * @description:
 * @author: HP
 * @time: 2020/9/18 21:40
 */
public class JingDongObserver implements Observer {

    @Override
    public void update(Observable o, Object product) {//通知
        String newProduct = (String)product;
        System.err.println("发送新产品{"+newProduct+"}同步到京东商城");
    }
//    public void update(Observable o, Object product) {
////        String newProduct = (String)product;
////        System.err.println("发送新产品{"+newProduct+"}同步到京东商城");
////    }
    public static void main(String[] args) {
        ProductList observable=ProductList.getInstance();
//        TaoBaoObserver taoBaoObserver = new TaoBaoObserver();
        JingDongObserver jdObserver = new JingDongObserver();
        observable.addObserver(jdObserver);
//        observable.addObserver(taoBaoObserver);
        observable.addProduct("新增产品1");
    }
}
